﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Jo.PropertyManagement.DataAccess.AbstractRepository;
using Jo.PropertyManagement.DataAccess.Repository;
using Jo.PropertyManagement.Domain.Entity;

namespace Jo.PropertyManagement.Test.DataAccess
{
    [TestFixture]
    public class TestCustomerRepository
    {
        ICustomerRepository customerRepo = null;
       
        [SetUp]
        public void Init()
        {
            customerRepo = new CustomerRepository();
        }

        [Test]
        public void TestCreateCustomer()
        {
            Customer cu = new Customer();
            cu.FirstName = "kandee";
            cu.LastName = "Siva";
            cu.Email = "lak@gmail.com";
            cu.PrimaryContactNo = "123";
            cu = customerRepo.CreateCustomer(cu);
            Assert.IsNotNull("Customer not created");
            Assert.IsTrue(cu.Id > 0, "Customer not created with new id");
        }

        [Test]
        public void TestGetLogInCustomerById()
        {
            Customer cu = customerRepo.GetLogInCustomerById(2);
            Assert.IsNotNull(cu,"No customer found");
            Assert.IsTrue(cu.Email == "lak@gmail.com", "email lak@gmail.com wrong");
        }

    }
}
